<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>4.5生命周期钩子</title>
</head>
<body>

    <div id="app">
        {{name}} 今年 {{num}} 岁
        <button v-on:click="add">+</button>
    </div>

    <!--<script src="node_modules/vue/dist/vue.js"></script>-->
    <!-- 开发环境版本，包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <!-- 生产环境版本，优化了尺寸和速度 -->
    <!--<script src="https://cdn.jsdelivr.net/npm/vue"></script>-->
    <script type="text/javascript">
        var app = new Vue({
            el:"#app",
            data:{
                name:"tom",
                num:5
            },
            methods:{
                add:function(){
                    this.num++;
                    console.log(this);
                }
            },
            created:function(){
                this.num = 20;
            }
        });
    </script>
</body>
</html>